﻿Imports System.Data.SqlClient
Imports System.Data
Imports System.Text.RegularExpressions

Public Class MembershipListing
    Inherits System.Web.UI.Page

Private Sub getData(ByVal user As String)

        Dim dt As New DataTable()
        ' Dim connection As New SqlConnection("Data Source=(localdb)\Projects;Initial Catalog=CIS441WinterParkWeb;Integrated Security=True;Connect Timeout=30;Encrypt=False;TrustServerCertificate=False")
        'Dim connectionString As String = "Data Source=SHANK-PC\SQLEXPRESS;Initial Catalog=WinterPark;Integrated Security=True;Connect Timeout=15;Encrypt=False;TrustServerCertificate=False"
        Dim connection As New SqlConnection(System.Configuration.ConfigurationManager.ConnectionStrings("MainConn").ConnectionString)
        connection.Open()
        Dim sqlCmd As New SqlCommand("SELECT UnitPrice from MembershipCodesTable", connection)
        Dim sqlDa As New SqlDataAdapter(sqlCmd)

        'sqlCmd.Parameters.AddWithValue("", )
        sqlDa.Fill(dt)
        If dt.Rows.Count > 0 Then
            FamPriceTextBox.Text = dt.Rows(0).ToString()  'Where ColumnName is the Field from the DB that you want to display
            'TextBox1.Text = dt.Rows(0)("Row2").ToString()
            'TextBox2.Text = dt.Rows(0)("Row3").ToString()
            'TextBox3.Text = dt.Rows(0)("Row4").ToString()
        End If
        connection.Close()
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load

        If Not Page.IsPostBack Then
            getData(Me.User.Identity.Name)
        End If

    End Sub
    Protected Sub btnReturn_Click(sender As Object, e As EventArgs) Handles btnReturn.Click
        'Return to Season Membership Page to complete transaction

        Server.Transfer("SeasonMembership.aspx")
    End Sub


End Class